home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_olv_bridge_pad.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  327 lines

  1. # Jones 3D Cog Script
  2. #
  3. # olv_bridge_pad.cog
  4. #
  5. # Cog to move snake bridges using pads.
  6. #
  7. # [DS & revised by HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ==============================================================================
  12.  
  13. symbols
  14.  
  15.     message        startup
  16.     message     entered
  17.     message     exited
  18.     message    activated
  19.     message        arrived
  20.     message        user0
  21.     message        user1
  22.  
  23.     keyframe    in_think=0in_figithat_4_4.key                local
  24.     keyframe    in_1to4=0in_stand1_bd_4.key                    local
  25.     keyframe    in_stand4=0in_stand4.key                    local
  26.     keyframe    nopush=in_pushpull_anticipate.key                local
  27.  
  28.     sound        plyerlvsnd=ov02j01.wav                        local    # "Whoops. I need something to hold this pressure pad down"
  29.     sound        plyersnd=inxj054.wav                        local    # "Must be a presure switch"
  30.     sound        blksnd=inxj112.wav                            local    # "That ought to do it"
  31.     sound        switchsnd=olv_presswitch_c.wav                local
  32.     sound        bridgesnd=olv_quetzdoor_move_c.wav            local
  33.     sound        brdgstop=olv_quetzdoor_stop_c.wav            local
  34.     sound        nope=inxj098.wav                        local    #It won't budge.
  35.  
  36.     thing        pad_indy
  37.     thing       bridge0                          
  38.     thing       bridge1
  39.     thing        block0
  40.     thing        pad_cam_1                                    nolink
  41.     thing        pad_poscam                                    nolink
  42.     thing        pad_ct_1                                    nolink
  43.     thing        pad_in_mk_1                                    nolink
  44.     thing        pad_in_mk_2                                    nolink
  45.  
  46.     surface     pad0                                        mask=0x480
  47.  
  48.     cog            otherpadcog_a                                # another instance of this cog
  49.     cog            otherpadcog_b                                # another instance of this cog
  50.     cog            jag2_cog                                    # to send flee to jag.
  51.  
  52.     vector        v_campos                                    local
  53.     flex        movespeed=1.0                                local
  54.     int            doorstatus=0                                local
  55.     int            redysteped=0                                local
  56.     int            sndplay=-1                                    local
  57.     int            curcam                                        local
  58.     int            track                                        local
  59.     int            noexitthistime=0                            local
  60.     int            startFOV_1                                    # value set in Marcus
  61.     int            startFOV_2                                    # value set in Marcus
  62.     int            finalFOV_1                                    # value set in Marcus
  63.     int            finalFOV_2                                    # value set in Marcus
  64.  
  65.  
  66.     thing        player            local
  67.     flex        opendoors            local
  68.     flex        close_doors            local
  69.     int        stepsnd            local
  70.     int        on_top=0            local
  71.  
  72. end
  73.  
  74. #-------------------------------------------------------------------------------
  75.  
  76. code
  77.  
  78. #...............................................................................
  79.  
  80. startup:
  81.  
  82.     # Print("bridgepad cog starting up...");
  83.  
  84.     player=GetLocalPlayerThing();
  85.     return;
  86.  
  87. #...............................................................................
  88. activated:
  89.     if(on_top == 1) return;
  90.         MakeMeStop();
  91.         DeselectWeaponWait(player);
  92.         StartCutscene(0);
  93.     PlayKey(player, nopush, 4, 0x12, 1);
  94.     PlayVoice(player, nope, 1.0, 1);
  95.         EndCutscene();
  96.     ClearActorFlags(player, 0x200000);
  97.     return;
  98. #...............................................................................
  99.  
  100. entered:
  101.  
  102.     if (getsenderref() != pad0) return;
  103.  
  104.     if (sndplay != -1)
  105.     {
  106.         StopSound(sndplay, 0);
  107.         sndplay = -1;
  108.     }
  109.  
  110.     PlaySoundLocal(switchsnd, 1.0, 0.0, 0x0, 0);
  111.  
  112.     if ((redysteped == 0) && (getsourceref() == player) && (getmovestatus(player) != 8))
  113.     {
  114.  
  115.         # Print("started switch cutscene");
  116.         noexitthistime = 1; # prevent exit messages while this scene plays
  117.  
  118.         # Prep...
  119.         curcam = GetCurrentCamera();
  120.         SendMessage(jag2_cog, user1);
  121.         MakeMeStop();
  122.         DeselectWeaponWait(player);
  123.         StartCutscene(1);
  124.         CopyOrient(player, pad_in_mk_1); # orient mark to match player
  125.         SetThingFlags(player, 0x80000);
  126.         ClearThingFlags(pad_indy, 0x80000);
  127.         CopyPlayerHolsters(player, pad_indy); # match props    
  128.         TeleportThing(pad_indy, pad_in_mk_1);
  129.         SetThingMaxRotVel(pad_indy, 180.0);
  130.         
  131.         # Cut to shot of Indy on pad...
  132.         SetCameraLookInterp(2, 0); # snap camera in place. 
  133.         SetCameraFocus(2, pad_cam_1);
  134.         SetCameraSecondaryFocus(2, pad_indy);
  135.            SetCurrentCamera(2);
  136.         SetCameraFOV(startFOV_1, 0, 0.0);
  137.          call OpenDoors;
  138.  
  139.         # Pan to bridge as Indy watches...
  140.         AISetLookThing(pad_indy, pad_ct_1);
  141.         SetCameraLookInterp(2, 1);
  142.         SetCameraInterpSpeed(2, 3.0);
  143.         Sleep(0.5);
  144.         SetCameraSecondaryFocus(2, pad_ct_1);
  145.         SetCameraFOV(finalFOV_1, 1, 3.0);
  146.         AIWaitForStop(pad_indy);
  147.         track = PlayKey(pad_indy, in_Stand4, 2, 0x0, 0);
  148.         PlayKey(pad_indy, in_1to4, 4, 0x12, 0);
  149.         stepsnd = PlayVoice(pad_indy, plyersnd, 1.0, 0);
  150.         WaitForStop(bridge0);
  151.         StopKey(pad_indy, track, 0.5);
  152.         Sleep(1.0);
  153.  
  154.         # Print("indy steps off switch...");
  155.         SetCameraLookInterp(2, 0);
  156.         SetCameraSecondaryFocus(2, pad_indy);
  157.         SetCameraFOV(startFOV_2, 0, 0);
  158.  
  159.         #  Move Indy off Pad...    
  160.         AISetMoveSpeed(pad_indy, 1.0);
  161.         AISetLookThingEyeLevel(pad_indy, pad_in_mk_2);
  162.         AISetMoveThing(pad_indy, pad_in_mk_2, 1);
  163.         PlaySoundLocal(switchsnd, 1.0, 0.0, 0x0, 0);
  164.  
  165.         # Cut to shot of bridge retracting...
  166.         call Close_Doors;
  167.         SetCameraLookInterp(2, 1);
  168.         AISetLookThing(pad_indy, pad_ct_1);
  169.         Sleep(0.5);
  170.         SetCAmeraInterpSpeed(2, 3.0);
  171.         Sleep(0.01);
  172.         SetCameraSecondaryFocus(2, pad_ct_1);
  173.         SetCameraFOV(finalFOV_2, 1, 2.5);
  174.         PlayVoice(player, plyerlvsnd, 1.0, 0);
  175.         waitForStop(bridge0);
  176.         Sleep(1.0);
  177.     
  178.         # Clean up & restore player control...
  179.         SetCameraLookInterp(2, 0);
  180.         SetCameraInterpSpeed(2, 1);    # reset default
  181.  
  182.         v_campos = GetThingPOS(pad_poscam); 
  183.         SetCameraPosition(1, v_campos); # prep to swing back to follow-cam
  184.         ResetCameraFOV(0, 0.0);
  185.         SetCurrentCamera(curcam);
  186.         SetCameraFOV(90, 0, 0);
  187.         TeleportThing(player, pad_indy); # orient player to actor
  188.         SetThingFlags(pad_indy, 0x80000);
  189.         ClearThingFlags(player, 0x80000);
  190.         ClearActorFlags(player, 0x200000);
  191.  
  192.         # Forbid pad cutscenes to repeat on other pads ...
  193.         SendMessage(otherpadcog_a, user0);
  194.         SendMessage(otherpadcog_b, user0);
  195.         redysteped=1;
  196.         noexitthistime=0;
  197.         EndCutscene();
  198.         # Print("ending cutscene 2...");
  199.         return;
  200.         }
  201.  
  202.  
  203. #=============================================================================
  204.         
  205.     if (getsourceref() == block0)
  206.     {
  207.         doorstatus=1;
  208.         redysteped = 1;
  209.  
  210.         # No longer able to move head.
  211.         ClearThingFlags(block0, 0x40000000);
  212.  
  213.         call OpenDoors;
  214.         PlayVoice(player, blksnd, 1.0, 0);
  215.  
  216.         return;
  217.     }
  218.     else
  219.     {
  220.         redysteped=1;
  221.         doorstatus=3;                    #player is on pad int.
  222.         call OpenDoors;
  223.     }
  224.  
  225.     return;
  226.  
  227. #...............................................................................
  228.     
  229. exited:
  230.     if(redysteped == 0) return;
  231.     if (getsenderref() != pad0 || (noexitthistime == 1))
  232.     {
  233.         return;
  234.     }
  235.  
  236.     if (sndplay != -1)
  237.     {
  238.         StopSound(sndplay, 0);
  239.         sndplay = -1;
  240.     }
  241.     PlaySoundLocal(switchsnd, 1.0, 0.0, 0x0, 0);
  242.  
  243.     if (getsourceref() == block0)
  244.     {
  245.         if(doorstatus == 3) return;            #player on pad.
  246.         doorStatus = 0;
  247.         call close_doors;
  248.         return;
  249.     }
  250.     else
  251.     {
  252.         if (doorstatus == 1)
  253.         {
  254.             return;            # block is on pad.
  255.         }
  256.         call close_doors;
  257.  
  258.     }
  259.  
  260.     return;
  261.  
  262. #...............................................................................
  263.  
  264. user0:
  265.  
  266.     # When received, kills ability to run pad cutscenes...
  267.  
  268.     redysteped = 1;
  269.     return;
  270.  
  271. #...............................................................................
  272.  
  273. user1:
  274.  
  275.     # Print("user1...");
  276.  
  277.     redysteped = 1;
  278.     call OpenDoors;
  279.  
  280.     return;
  281.  
  282. #...............................................................................
  283.  
  284. arrived:
  285.  
  286.     # Print("arrived...");
  287.  
  288.     if ((GetSenderRef() == bridge0) || (Getsenderref() == bridge1))
  289.     {         
  290.         if (sndplay != -1)
  291.         {
  292.             StopSound(sndplay, 0);
  293.             sndplay = -1;
  294.         }
  295.  
  296.         PlaySoundThing(brdgstop, bridge0, 1, 20, 55, 0);
  297.     }
  298.  
  299.     return;
  300.  
  301. #...............................................................................
  302.  
  303. OpenDoors:
  304.  
  305.     # Print("opendoors...");
  306.  
  307.     MoveToFrame(bridge0, 1, moveSpeed);
  308.     MoveToFrame(bridge1, 1, moveSpeed);    
  309.     sndplay = PlaySoundThing(bridgesnd, bridge0, 1, 20, 55, 1);
  310.  
  311.     return;
  312.  
  313. #...............................................................................
  314.  
  315. close_doors:
  316.  
  317.     # Print("closedoors...");
  318.  
  319.     movetoframe(bridge0, 0, movespeed);
  320.     movetoframe(bridge1, 0, movespeed);
  321.     sndplay = PlaySoundThing(bridgesnd, bridge0, 1, 20, 55, 1);
  322.  
  323.     return;
  324.  
  325. end
  326.  
  327.